Skip to content

feat: persist grep-friendly local thread history - #18

Open
davefmurray wants to merge 1 commit into
ScriptedAlchemy:mainfrom
davefmurray:feat/local-thread-history
Open

feat: persist grep-friendly local thread history#18
davefmurray wants to merge 1 commit into
ScriptedAlchemy:mainfrom
davefmurray:feat/local-thread-history

Conversation

@davefmurray

Copy link
Copy Markdown

The CLI currently displays live threads but leaves no local copy to search later. This adds automatic, grep-friendly JSONL history at ~/.grok-bot-cli/history.jsonl: successful send commands record prompts, and thread/chat record fetched messages with full text, target IDs/names, roles, recording times, and available message/root IDs.

gbot history Researcher --search timeout
gbot history --search timeout --limit 100 --json
grep -in 'timeout' "$(gbot history --path)"

History commands run offline before backend/auth initialization. --history-dir / GROK_BOT_HISTORY_DIR configure storage; --no-history / GROK_BOT_HISTORY=off disable recording. New directories/files use 0700/0600 permissions, writes refuse file symlinks, and only conversation fields are saved. Disk failures warn on stderr without making a successful send look failed. Reads skip malformed records, and the next append separates an interrupted final record.

This records CLI observations: replies are saved when fetched, repeated fetches append repeated observations, and there is no background sync, deduplication, expiry, or session resumption. Conversation text is stored as plaintext; these limits and opt-outs are documented.

The shared transcript parser also handles array-shaped responses correctly and prefers full content over previews. Includes README/help updates and a minor changeset.

Validation: all 34 tests pass on Node 18, 22, and 24, including 10 new integration tests using a local mock gateway and isolated temporary homes. Coverage includes persistence across processes, real grep, bot/group filtering, multiline/long content, opt-outs, failed sends, disk errors, concurrent appends, and malformed history. Publint 0.3.24 and packed executable install/help/offline-history smoke checks pass. No live bot operations were used.

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0bcd5b8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
grok-bot-cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant